<template>
  <div>
    <HeaderNav title="我的跟帖"></HeaderNav>
    <div class="listWrapper">
      <div class="item" v-for="comment in commentList" :key="comment.id">
        <div class="date">{{comment.create_date.split("T")[0]}}</div>
        <div class="huifuWrapper" v-if="comment.parent">
          <div class="name">回复:{{comment.parent.user.nickname}}</div>
          <div class="InputConent">{{comment.parent.content}}</div>
        </div>
        <div class="content">{{comment.content}}</div>
        <div class="yuanwen">原文:{{comment.post.title}}</div>
      </div>
      <div class="moreComment" @click="$router.push('/morecomment?id='+$route.query.id)">更多跟帖>>></div>
    </div>
  </div>
</template>

<script>
import HeaderNav from "../components/headerNav";
export default {
  components: {
    HeaderNav,
  },
  data() {
    return {
      commentList: [],
    };
  },
  created() {
    this.$axios({
      url: "/user_comments",
    }).then((res) => {
      console.log(res.data);
      this.commentList = res.data.data;
    });
  },
};
</script>

<style lang="less" scoped>
.item {
  padding: 20/360 * 100vw;
  border-bottom: 1px solid #e4e4e4;
  .date {
    font-size: 12/360 * 100vw;
    color: #888;
  }
  .huifuWrapper {
    margin: 10/360 * 100vw 0;
    padding: 10/360 * 100vw;
    background-color: #e4e4e4;
    color: #666;
    .name {
      font-size: 12/360 * 100vw;
    }
    .InputConent {
      margin-top: 5/360 * 100vw;
      font-size: 12/360 * 100vw;
    }
  }
  .content {
    margin: 10/360 * 100vw 0;
  }
  .yuanwen {
    font-size: 12/360 * 100vw;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
.moreComment {
  width: 120/360 * 100vw;
  text-align: center;
  margin: 30/360 * 100vw auto;
  color: #888;
}
</style>